<?php

namespace app\api\controller;
use \app\api\model\Student;

class Base
{
    //注册功能
    public function register()
    {
        //传入学号，姓名，密码注册
        $no = input('get.no');
        $name = input('get.name');
        $password =input('get.password');
        if (empty($no)||empty ($name||empty($password))) {
            output_error('请填写完整信息');
        }
        $condition = array();
        $condition[]=['member_no','=',$no];
        $condition[] =['member_password','=',dm5($password)];
        //规则1：学号唯一
        $data = Student::where('member_no','=',$no)->find();
        if (!empty($data)) output_error('学号以被注册');
        //规则2：密码md5加密
    }

    //找回密码
    public function findpass()
    {
        //通过学号，姓名重置密码
        $no = input('get.no');
        $name = input('get.name');
        $password =input('get.password');
        if (empty($no)||empty ($name||empty($password))) {
            output_error('请填写完整信息');
        }
        //规则1：密码md5加密
    }

    //登录功能
    public function login()
    {
        //通过学号，密码登录，返回Token
        $no = input('get.no');
        $name = input('get.name');
        $password =input('get.password');
        if (empty($no)||empty ($name||empty($password))) {
            output_error('请填写完整信息');
        }
        $condition = array();
        $condition[]=['member_no','=',$no];
        $condition[] =['member_password','=',dm5($password)];
        if (empty($data))output_error('学号与密码不一致');
        //规则1：token由学号+当前时间戳md5加密生成
    }

}
